package com.wish.wishhouse_foreclosure.enums;

public enum DeviceType {
	PC(1, "电脑端") {
		public boolean isPC() {
			return true;
		}
		public boolean isMobile() {
			return false;
		}
	},
	MOBILE(2, "手机端") {
		public boolean isPC() {
			return false;
		}
		public boolean isMobile() {
			return true;
		}
	},
	;

	public static DeviceType fromCode(int statusCode) {
		for (DeviceType status : values()) {
			if (status.code == statusCode) {
				return status;
			}
		}
		throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
	}

	private final int code;
	private final String name;
	DeviceType(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public int getCode() {
		return this.code;
	}

	public String getName() {
		return this.name;
	}

	public boolean isPC() {
		throw new AbstractMethodError();
	}
	public boolean isMobile() {
		throw new AbstractMethodError();
	}
}
